package com.ctbri.containerindepth;

import java.util.PriorityQueue;
import java.util.Random;

public class Ex11 implements Comparable<Ex11>{
	
	private static final Random random = new Random();
	private int order = random.nextInt(101);

	@Override
	public int compareTo(Ex11 o) {
		if(order < o.order)
			return -1;
		else if(order == o.order)
			return 0;
		return 1;
	}
	
	@Override
	public String toString() {
		return  order + "";
	}

	
	public static void main(String[] args) {
		PriorityQueue<Ex11> pq = new PriorityQueue<>();
		for(int i = 0; i < 10; i++)
			pq.offer(new Ex11());
		Ex11 item;
		while((item = pq.poll()) != null)
			System.out.println(item);
	}
}
